From: emellor@ewan Date: Sun, 18 Sep 2005 09:09:22 +0000 (+0100) Subject: In all cases, move the creation of a new transaction outside of the block X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16780^2~47^2~8 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=00cac7da1ccaeb07bc0d94c5c6453f55b6259d4b;p=xen.git In all cases, move the creation of a new transaction outside of the block handling exceptions raised inside that transaction. If the creation (start) of the transaction fails, then t has not been assigned, and in any case no transaction has been created, so it is wrong to attempt to abort that (non-existent) transaction. Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/xend/xenstore/xstransact.py b/tools/python/xen/xend/xenstore/xstransact.py index 3c56251659..d76dd88a90 100644 --- a/tools/python/xen/xend/xenstore/xstransact.py +++ b/tools/python/xen/xend/xenstore/xstransact.py @@ -151,8 +151,8 @@ class xstransact: def Read(cls, path, *args): while True: + t = cls(path) try: - t = cls(path) v = t.read(*args) t.commit() return v @@ -170,8 +170,8 @@ class xstransact: def Write(cls, path, *args, **opts): while True: + t = cls(path) try: - t = cls(path) t.write(*args, **opts) t.commit() return @@ -189,8 +189,8 @@ class xstransact: def Remove(cls, path, *args): while True: + t = cls(path) try: - t = cls(path) t.remove(*args) t.commit() return @@ -208,8 +208,8 @@ class xstransact: def List(cls, path, *args): while True: + t = cls(path) try: - t = cls(path) v = t.list(*args) t.commit() return v @@ -227,8 +227,8 @@ class xstransact: def Gather(cls, path, *args): while True: + t = cls(path) try: - t = cls(path) v = t.gather(*args) t.commit() return v @@ -246,8 +246,8 @@ class xstransact: def Store(cls, path, *args): while True: + t = cls(path) try: - t = cls(path) v = t.store(*args) t.commit() return v